package com.br.apurn.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="USER")
public class Usuario implements Persistente { 

	private static final long serialVersionUID = 1L;

	@Id	
	@Column(name="user_id", nullable=false)	
	@SequenceGenerator(name="my_seq", sequenceName="account_user_id_seq")
	@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="my_seq")
	private Integer userId;
	
	@Column(name="NAME")
	private String username;
	
	@Column(name="PASSWORD")
	private String password;
	
	@Column(name = "ENABLE", columnDefinition = "BOOLEAN")
    private boolean enable;
	
    @OneToMany
    private List<Authorization> authorizations;
	
	public Usuario() {
		
	}
	
	public Usuario(Integer id, String name, String password) {
		super();
		this.userId = id;
		this.username = name;
		this.password = password;
	}
	
	
	public String getName(){
		return username;
	}
	
	public String getPassword(){
		return password;
	}
	
	public void setName(String name_){
		username = name_;
	}
	
	public void setPassword(String password_){
		password = password_;
	}

	@Override
	public int getId() {
		return userId;
	}

	@Override
	public void setId(int id) {
		this.userId = id;
		
	}
	

}
